package com.itheima.controller;

import com.itheima.entity.PageBean;
import com.itheima.entity.Result;
import com.itheima.service.OperateLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class OperateLogController {
    @Autowired
    private OperateLogService operateLogService;

    /**
     * 日志分页查询
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("/log/page")
    public Result logPage(@RequestParam(defaultValue = "1") Integer page,
                          @RequestParam(defaultValue = "10") Integer pageSize){
        log.info("日志列表查询：{}, {}", page, pageSize);
        PageBean pageBean = operateLogService.logPage(page, pageSize);
        return Result.success(pageBean);
    }
}
